package com.sc.nft.entity.dto;

import com.sc.nft.entity.UserCoupons;
import com.sc.nft.util.Beans;
import lombok.Data;

import java.util.Objects;

/**
 * @author liGen
 * @version 1.0
 * @date 2023/7/5 14:40
 */
@Data
public class UseUserCouponsDTO extends UserCoupons {

    /**
     * 是否可以使用
     */
    Boolean canUse;

    /**
     * 不能使用原因
     */
    String canNotUseReason;

    public static UseUserCouponsDTO build(UserCoupons uc, boolean canUse, String canNotUseReason) {
        UseUserCouponsDTO dto = new UseUserCouponsDTO();
        if (Objects.nonNull(uc)) {
            Beans.copyPropertiesIgnoreNull(uc, dto);
        }
        dto.canUse = canUse;
        dto.canNotUseReason = canNotUseReason;
        return dto;
    }
}
